package com.example;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnResource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Date;

@Configuration
@ConditionalOnClass(name = "com.example.SomeClass")
@ConditionalOnProperty(name = "date",havingValue = "true")
@ConditionalOnResource(resources = "classpath:date.yaml")
//根据是否有某一class,配置属性中是否有：data=true,资源中是否有data.yaml来决定
//是否产生Date对象
public class MyConf {
    @Bean
    public Date date(){
        return new Date(100,10,10);
    }
}
